<?php
class A {
    public $name; //名字
    function __construct($name){ //构造函数
    $this->name = $name;
    }
    
    function test(){
    echo $this->name;
    }
    }
    
    //派生类
    class B extends A{
    function __construct(){
    parent::__construct("测试"); //调用或者说继承父类的构造函数:
    self::test();
    }
    }
    $b = new B();
?>
